import AbstractCat2DocFile from "./file";
import html2pdf from "html2pdf.js";
class PdfFile extends AbstractCat2DocFile {
    /** 获取文件扩展名 */
    getExtension(){
        return "PDF"
    }
    /** 导出文件 */
    export(fileName, element) {
        return new Promise((resolve,reject)=> {
            try {
                let opt = {
                    margin: 1,
                    filename: 'output.pdf',
                    image: {type: 'jpeg', quality: 0.98},
                    html2canvas: {scale: 2},
                    jsPDF: {unit: 'in', format: 'letter', orientation: 'portrait'}
                };
                html2pdf().set(opt).from(element).save();
                resolve({});
            }catch (err) {
                reject(err)
            }
        });
    }
    /** 导入文件 */
    import(file) {
        throw new Error('This feature is not yet available!')
    }
}
export default PdfFile;
